package ex41212;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;

/**
 * @AUTHOR 尹书岿
 * @DATE 2024/12/12 13:06
 * @DESCRIBE
 */
public class excoption {
    public static void main(String[] args) throws Exception {
        File f = new File("a.txt");
        //添加参数 确定不覆盖 而是追加
        FileWriter fileWriter = new FileWriter(f,true);

        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
        bufferedWriter.write("hello\n");
        bufferedWriter.write("world");

        bufferedWriter.close();
        fileWriter.close();
    }
}
